from selenium.webdriver.common.by import By
from pages.base_page import BasePage


class LoginPage(BasePage):

    username_locator = (By.NAME,'name')
    password_locator = (By.NAME, 'password')
    submit_locator = (By.NAME, 'submit')
    url ="http://192.168.1.55/crm"

    # def __init__(self,driver):
    #     '''要求实例化的时候传递driver'''
    #     self.driver = driver

    def username_input(self,username):
        self.driver.find_element(*self.username_locator).send_keys(username)

    def password_input(self,password):
        self.driver.find_element(*self.password_locator).send_keys(password)

    def sumbit_click(self):
        self.driver.find_element(*self.submit_locator).click()

    def open(self):
        self.driver.get(self.url)